<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>组件基础-组件上使用 v-model</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <style>

    </style>
</head>
<body>
<div id="app">

    <h3>自定义的输入输出的文本框</h3>
    <custom-input v-model="searchText"></custom-input>
    <p>显示：{{searchText}}</p>
</div>


<script>


    Vue.component("custom-input",{
        props:["value"],
        template:"<input v-bind:value='value' v-on:input='$emit(\"input\",$event.target.value)'>"
    });

    var app= new Vue({
        el:'#app',
        data:{
            searchText:'',
        },
        methods:{

        }
    })
</script>
</body>
</html>
